import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'root',
      redirect: '/home',
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('@/views/home/index.vue'),
    },
    {
      path: '/detail/:id',
      name: 'detail',
      component: () => import('@/views/detail/index.vue'),
    },
    {
      path: '/publish',
      name: 'publish',
      component: () => import('@/views/publish/index.vue'),
    },
    {
      path: '/exhibit',
      name: 'exhibit',
      component: () => import('@/views/exhibit/index.vue'),
    },
    {
      path: '/user',
      name: 'user',
      component: () => import('@/layouts/UserLayout/index.vue'),
      children: [
        {
          path: 'login',
          name: 'login',
          component: () => import('@/views/user/login/index.vue'),
        },
        {
          path: 'register',
          name: 'register',
          component: () => import('@/views/user/register/index.vue'),
        },
      ],
    },
  ],
})

export default router
